<div class='form-group'>
    <div class='col-sm-offset-1 col-sm-10'>
        <div class="page-header">
            <h1>Les Visiteurs <small> | Cumul des frais</small></h1>
        </div>
        <div class="table-responsive">
            <table class='table table-hover table-striped table-bordered'>
                <thead>
                    <tr>
                        <th>ID</th>
                        <th>Mois</th>
                        <th>ETP</th>
                        <th>KM</th>
                        <th>NUI</th>
                        <th>REP</th>
                    </tr>
                </thead>
                <?php
                $totalETP = 0;
                $totalKM = 0;
                $totalNUI = 0;
                $totalREP = 0;
                $i = 0;
                while ($i < count($this->lesStats)) {
                    $currentVisiteur = $this->lesStats[$i]['idvisiteur'];
                    $fraisETP = 0;
                    $fraisKM = 0;
                    $fraisNUI = 0;
                    $fraisREP = 0;
                    while ($i < count($this->lesStats) && $currentVisiteur == $this->lesStats[$i]['idvisiteur']) {
                        ?>   
                        <tr>
                            <td> <?php echo $this->lesStats[$i]['idvisiteur'] ?> </td>
                            <td> <?php echo $this->lesStats[$i]['mois'] ?> </td>
                            <td> <?php echo $this->lesStats[$i]['ETP'] ?> </td> 
                            <td> <?php echo $this->lesStats[$i]['KM'] ?> </td> 
                            <td> <?php echo $this->lesStats[$i]['NUI'] ?> </td> 
                            <td> <?php echo $this->lesStats[$i]['REP'] ?> </td> 
                        </tr>
                        <?php
                        $fraisETP += $this->lesStats[$i]['ETP'];
                        $fraisKM += $this->lesStats[$i]['KM'];
                        $fraisNUI += $this->lesStats[$i]['NUI'];
                        $fraisREP += $this->lesStats[$i]['REP'];
                        $i++;
                    }
                    ?>
                    <tr class="info">
                        <td> BILAN </td>
                        <td> </td>
                        <td> <?php echo $fraisETP ?> </td> 
                        <td> <?php echo $fraisKM ?> </td> 
                        <td> <?php echo $fraisNUI ?> </td> 
                        <td> <?php echo $fraisREP ?> </td> 
                    </tr>
                    <?php
                    $totalETP += $fraisETP;
                    $totalKM += $fraisKM;
                    $totalNUI += $fraisNUI;
                    $totalREP += $fraisREP;
                }
                ?>
                <tr class="success">
                    <td> TOTAL</td>
                    <td> </td>
                    <td> <?php echo $totalETP ?> </td> 
                    <td> <?php echo $totalKM ?> </td> 
                    <td> <?php echo $totalNUI ?> </td> 
                    <td> <?php echo $totalREP ?> </td> 
                </tr>
            </table>
        </div>
    </div>
</div>